/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cse308.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aaron
 */
@Entity
@Table(catalog = "nchorn", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Targetdirectassessment.findAll", query = "SELECT t FROM Targetdirectassessment t"),
    @NamedQuery(name = "Targetdirectassessment.findBySemester", query = "SELECT t FROM Targetdirectassessment t WHERE t.targetdirectassessmentPK.semester = :semester"),
    @NamedQuery(name = "Targetdirectassessment.findByAttainmentlevel", query = "SELECT t FROM Targetdirectassessment t WHERE t.attainmentlevel = :attainmentlevel"),
    @NamedQuery(name = "Targetdirectassessment.findByStudentoutcome", query = "SELECT t FROM Targetdirectassessment t WHERE t.targetdirectassessmentPK.studentoutcome = :studentoutcome")})
public class Targetdirectassessment implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TargetdirectassessmentPK targetdirectassessmentPK;
    private Integer attainmentlevel;
    @JoinColumn(name = "studentoutcome", referencedColumnName = "identifier", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Studentoutcome studentoutcome1;

    public Targetdirectassessment() {
    }

    public Targetdirectassessment(TargetdirectassessmentPK targetdirectassessmentPK) {
        this.targetdirectassessmentPK = targetdirectassessmentPK;
    }

    public Targetdirectassessment(String semester, String studentoutcome) {
        this.targetdirectassessmentPK = new TargetdirectassessmentPK(semester, studentoutcome);
    }

    public TargetdirectassessmentPK getTargetdirectassessmentPK() {
        return targetdirectassessmentPK;
    }

    public void setTargetdirectassessmentPK(TargetdirectassessmentPK targetdirectassessmentPK) {
        this.targetdirectassessmentPK = targetdirectassessmentPK;
    }

    public Integer getAttainmentlevel() {
        return attainmentlevel;
    }

    public void setAttainmentlevel(Integer attainmentlevel) {
        this.attainmentlevel = attainmentlevel;
    }

    public Studentoutcome getStudentoutcome1() {
        return studentoutcome1;
    }

    public void setStudentoutcome1(Studentoutcome studentoutcome1) {
        this.studentoutcome1 = studentoutcome1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (targetdirectassessmentPK != null ? targetdirectassessmentPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Targetdirectassessment)) {
            return false;
        }
        Targetdirectassessment other = (Targetdirectassessment) object;
        if ((this.targetdirectassessmentPK == null && other.targetdirectassessmentPK != null) || (this.targetdirectassessmentPK != null && !this.targetdirectassessmentPK.equals(other.targetdirectassessmentPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cse308.entities.Targetdirectassessment[ targetdirectassessmentPK=" + targetdirectassessmentPK + " ]";
    }
    
}
